<?php $this -> load -> view('adminx/header'); ?>
<!-- BEGIN CONTAINER -->
<div class="page-container">
	<!-- BEGIN SIDEBAR -->
	<?php $this -> load -> view('adminx/mune'); ?>
	<!-- END SIDEBAR -->
	<!-- BEGIN CONTENT -->
	<div class="page-content-wrapper">
		<div class="page-content">
			<!-- BEGIN SAMPLE PORTLET CONFIGURATION MODAL FORM-->
			<!-- /.modal -->
			<h3 class="page-title"> <?php echo $title; ?> <small>Logistics</small></h3>
			<div class="page-bar">
				<ul class="page-breadcrumb">
					<li>
						<i class="fa fa-home"></i>
						<a href="/adminx">首页</a>
						<i class="fa fa-angle-right"></i>
					</li>
					<li>
						<a href="/iadmin/bill">订单</a>
						<i class="fa fa-angle-right"></i>
					</li>
					<li>
						<a href="#">物流</a>
					</li>
				</ul>
			</div>
			<!-- END PAGE HEADER-->
			<div class="clearfix"></div>
			<div class="row">
				<div class="col-md-12 col-sm-12">
					
<div class="media">
  <div class="media-body">
  	<p class=""><img width="100" src="<?php echo $m['headimgurl']?$m['headimgurl']:'/mex/lance/img/tx.jpg'; ?>" /></p>
  	<p class="">姓名：<?php echo $bill['name']; ?></p>
  	<p class="">手机：<?php echo $bill['phone']; ?></p>
  	<p class="">地区：<?php echo $bill['dq']; ?></p>
  	<p class="">地址：<?php echo $bill['zz']; ?></p>
    <p class="">订单编码：<?php echo sprintf("%08d",$bill['bill_id']); ?></p>
    <p class="">购买时间：<?php echo date('Y-m-d H:i',$bill['mktime']); ?></p>
    <p class="">购买IP：<?php echo $bill['mkip']; ?></p>
    <p class="">物流：<?php echo $bill['wl_name']; ?></p>
    <p class="">物流订单号：<?php echo $bill['wl_hao']; ?> <button onclick="show_wl_up()" type="button" class="btn btn-default">修改物流</button></p>
    <hr />
    <p class="text-right">
        <span class="text-danger">￥<?php echo $bill['je']; ?></span>
    </p>
  </div>
</div>
<hr />
<div class="panel panel-default">
				<div class="panel-heading">
					购买内容
				</div>
				<div class="panel-body">
				
<table class="table table-hover table-responsive table-bordered">
					<thead>
						<tr>
							<th>封面</th>
							<th>名称</th>
							<th>价格</th>
							<th>供货款</th>
							<th>一级代理</th>
							<th>二级代理</th>
							<th>三级代理</th>
							<th>礼券</th>
							<th>数量</th>
							<th>金额</th>
						</tr>
					</thead>
					<tbody>
						<?php  foreach($bill_item as $v){?>
						<tr>
							<td><img src="<?php echo $v['pic1']?$this->pub->oss_dz($v['pic1']):'/style/images/logo.png'; ?>" width="80"></td>
							<td><?php echo $v['sp_name']; ?></td>
							<td><?php echo $v['sp_price']; ?></td>
							<td><?php echo $v['sk_je']; ?></td>
							<td><?php echo $v['sp_dl']; ?></td>
							<td><?php echo $v['sp_dl1']; ?></td>
							<td><?php echo $v['sp_dl2']; ?></td>
							<td><?php echo $v['sp_lq']; ?></td>
							<td><?php echo $v['numb']; ?></td>
							<td><?php echo $v['je']; ?></td>
						</tr>
						<?php } ?>
					</tbody>
</table>
</div>
</div>
<div class="panel panel-default">
				<div class="panel-heading">
					分销情况
				</div>
				<div class="panel-body">
				
<table class="table table-hover table-responsive table-bordered">
					<thead>
						<tr>
							<th width="50">级别</th>
							<th width="100">头像</th>
							<th width="150">昵称</th>
							<th>手机</th>
						</tr>
					</thead>
					<tbody>
						<?php  foreach($ms as $k=>$v){?>
						<tr>
							<td><?php echo $k; ?></td>
							<td><a href="/iadmin/member/info/<?php echo $v['mid']; ?>" target="_blank"><img src="<?php echo $v['headimgurl']?$v['headimgurl']:'/mex/lance/img/tx.jpg'; ?>" width="80"></a></td>
							<td><?php echo $v['nickname']; ?></td>
							<td><?php echo $v['phone']; ?></td>
						</tr>
						<?php } ?>
					</tbody>
</table>
</div>
</div>
<div class="panel panel-default">
				<div class="panel-heading">
					现金流情况
				</div>
				<div class="panel-body">
				
<table class="table table-hover table-responsive table-bordered">
					<thead>
						<tr>
							<th>ID</th>
							<th>头像</th>
							<th>昵称</th>
							<th>类型</th>
							<th>金额</th>
							<th>内容</th>
							<th>备注</th>
							<th>时间</th>
							<th>状态</th>
						</tr>
					</thead>
					<tbody>
						<?php
						$state[1] = '正常';
		                 $state[2] = '待处理';
		                 $state[-1] = '作废';

						  foreach($jb1 as $v){?>
						<tr>
							<td><?php echo $v['id']; ?></td>
							<td><a href="/iadmin/member/info/<?php echo $v['mid']; ?>" target="_blank"><img src="<?php echo  $v['headimgurl']? $v['headimgurl']:'/mex/lance/img/tx.jpg'; ?>" width="80"></a></td>
							<td><?php echo $v['nickname']; ?></td>
							<td><?php echo $type[$v['type']]; ?></td>
							<td><?php echo $v['je']; ?></td>
							<td><?php echo $v['content'] . ($v['type'] == '-1' ? ($v['stime'] ? '提现处理时间：' . date('Y-m-d H:i', $v['stime']) : '提现等待处理') : ''); ?></td>
							<td><?php echo $v['note']; ?></td>
							<td><?php echo date('Y-m-d H:i:s', $v['mktime']); ?></td>
							<td><?php echo $state[$v['state']]; ?></td>
						</tr>
						<?php } ?>
						
						<?php  foreach($jb2 as $v){ ?>
							<tr>
							<td><?php echo $v['id']; ?></td>
							<td><a href="/iadmin/member/info/<?php echo $v['mid']; ?>" target="_blank"><img src="<?php echo  $v['headimgurl']? $v['headimgurl']:'/mex/lance/img/tx.jpg'; ?>" width="80"></a></td>
							<td><?php echo $v['nickname']; ?></td>
							<td><?php echo $type[$v['type']]; ?></td>
							<td><?php echo $v['je']; ?></td>
							<td><?php echo $v['content'] . ($v['type'] == '-1' ? ($v['stime'] ? '提现处理时间：' . date('Y-m-d H:i', $v['stime']) : '提现等待处理') : ''); ?></td>
							<td><?php echo $v['note']; ?></td>
							<td><?php echo date('Y-m-d H:i:s', $v['mktime']); ?></td>
							<td><?php echo $state[$v['state']]; ?></td>
						</tr>
						<?php } ?>
						
						<?php  foreach($jb3 as $v){  ?>
							<tr>
							<td><?php echo $v['id']; ?></td>
							<td><a href="/iadmin/member/info/<?php echo $v['mid']; ?>" target="_blank"><img src="<?php echo  $v['headimgurl']? $v['headimgurl']:'/mex/lance/img/tx.jpg'; ?>" width="80"></a></td>
							<td><?php echo $v['nickname']; ?></td>
							<td><?php echo $type[$v['type']]; ?></td>
							<td><?php echo $v['je']; ?></td>
							<td><?php echo $v['content'] . ($v['type'] == '-1' ? ($v['stime'] ? '提现处理时间：' . date('Y-m-d H:i', $v['stime']) : '提现等待处理') : ''); ?></td>
							<td><?php echo $v['note']; ?></td>
							<td><?php echo date('Y-m-d H:i:s', $v['mktime']); ?></td>
							<td><?php echo $state[$v['state']]; ?></td>
						</tr>
						<?php
						$this -> db -> select('pan_jb.*,pan_member.headimgurl,pan_member.nickname,pan_member.js,pan_member.yh,pan_member.openid');
						$this -> db -> join('member', 'pan_member.mid=pan_jb.mid');
						$q = $this -> db -> get_where('jb', array('pan_jb.type' => -5, 'did' => '-5-' . $v['id']));
						if ($q -> num_rows() == 0) {
							echo '<tr><td colspan="9">红包没有发送出去</td></tr>';
						}else{
						$ls=$q->row_array(0);
							?>
							<tr>
							<td><?php echo $ls['id']; ?></td>
							<td><a href="/iadmin/member/info/<?php echo $ls['mid']; ?>" target="_blank"><img src="<?php echo  $ls['headimgurl']? $ls['headimgurl']:'/mex/lance/img/tx.jpg'; ?>" width="80"></a></td>
							<td><?php echo $ls['nickname']; ?></td>
							<td><?php echo $type[$ls['type']]; ?></td>
							<td><?php echo $ls['je']; ?></td>
							<td><?php echo $ls['content'] . ($v['type'] == '-1' ? ($ls['stime'] ? '提现处理时间：' . date('Y-m-d H:i', $ls['stime']) : '提现等待处理') : ''); ?></td>
							<td><?php echo $ls['note']; ?></td>
							<td><?php echo date('Y-m-d H:i:s', $ls['mktime']); ?></td>
							<td><?php echo $state[$ls['state']]; ?></td>
						</tr>
						<?php }  } ?>
						
						
						<?php  foreach($jb4 as $v){  ?>
							<tr>
							<td><?php echo $v['id']; ?></td>
							<td><a href="/iadmin/member/info/<?php echo $v['mid']; ?>" target="_blank"><img src="<?php echo  $v['headimgurl']? $v['headimgurl']:'/mex/lance/img/tx.jpg'; ?>" width="80"></a></td>
							<td><?php echo $v['nickname']; ?></td>
							<td><?php echo $type[$v['type']]; ?></td>
							<td><?php echo $v['je']; ?></td>
							<td><?php echo $v['content'] . ($v['type'] == '-1' ? ($v['stime'] ? '提现处理时间：' . date('Y-m-d H:i', $v['stime']) : '提现等待处理') : ''); ?></td>
							<td><?php echo $v['note']; ?></td>
							<td><?php echo date('Y-m-d H:i:s', $v['mktime']); ?></td>
							<td><?php echo $state[$v['state']]; ?></td>
						</tr>
						<?php
						$this -> db -> select('pan_jb.*,pan_member.headimgurl,pan_member.nickname,pan_member.js,pan_member.yh,pan_member.openid');
						$this -> db -> join('member', 'pan_member.mid=pan_jb.mid');
						$q = $this -> db -> get_where('jb', array('pan_jb.type' => -5, 'did' => '-5-' . $v['id']));
						if ($q -> num_rows() == 0) {
							echo '<tr><td colspan="9">红包没有发送出去</td></tr>';
						}else{
						$ls=$q->row_array(0);
							?>
							<tr>
							<td><?php echo $ls['id']; ?></td>
							<td><a href="/iadmin/member/info/<?php echo $ls['mid']; ?>" target="_blank"><img src="<?php echo  $ls['headimgurl']? $ls['headimgurl']:'/mex/lance/img/tx.jpg'; ?>" width="80"></a></td>
							<td><?php echo $ls['nickname']; ?></td>
							<td><?php echo $type[$ls['type']]; ?></td>
							<td><?php echo $ls['je']; ?></td>
							<td><?php echo $ls['content'] . ($v['type'] == '-1' ? ($ls['stime'] ? '提现处理时间：' . date('Y-m-d H:i', $ls['stime']) : '提现等待处理') : ''); ?></td>
							<td><?php echo $ls['note']; ?></td>
							<td><?php echo date('Y-m-d H:i:s', $ls['mktime']); ?></td>
							<td><?php echo $state[$ls['state']]; ?></td>
						</tr>
						<?php }  } ?>
						
						
						<?php  foreach($jb5 as $v){  ?>
							<tr>
							<td><?php echo $v['id']; ?></td>
							<td><a href="/iadmin/member/info/<?php echo $v['mid']; ?>" target="_blank"><img src="<?php echo  $v['headimgurl']? $v['headimgurl']:'/mex/lance/img/tx.jpg'; ?>" width="80"></a></td>
							<td><?php echo $v['nickname']; ?></td>
							<td><?php echo $type[$v['type']]; ?></td>
							<td><?php echo $v['je']; ?></td>
							<td><?php echo $v['content'] . ($v['type'] == '-1' ? ($v['stime'] ? '提现处理时间：' . date('Y-m-d H:i', $v['stime']) : '提现等待处理') : ''); ?></td>
							<td><?php echo $v['note']; ?></td>
							<td><?php echo date('Y-m-d H:i:s', $v['mktime']); ?></td>
							<td><?php echo $state[$v['state']]; ?></td>
						</tr>
						<?php
						$this -> db -> select('pan_jb.*,pan_member.headimgurl,pan_member.nickname,pan_member.js,pan_member.yh,pan_member.openid');
						$this -> db -> join('member', 'pan_member.mid=pan_jb.mid');
						$q = $this -> db -> get_where('jb', array('pan_jb.type' => -5, 'did' => '-5-' . $v['id']));
						if ($q -> num_rows() == 0) {
							echo '<tr><td colspan="9">红包没有发送出去</td></tr>';
						}else{
						$ls=$q->row_array(0);
							?>
							<tr>
							<td><?php echo $ls['id']; ?></td>
							<td><a href="/iadmin/member/info/<?php echo $ls['mid']; ?>" target="_blank"><img src="<?php echo  $ls['headimgurl']? $ls['headimgurl']:'/mex/lance/img/tx.jpg'; ?>" width="80"></a></td>
							<td><?php echo $ls['nickname']; ?></td>
							<td><?php echo $type[$ls['type']]; ?></td>
							<td><?php echo $ls['je']; ?></td>
							<td><?php echo $ls['content'] . ($v['type'] == '-1' ? ($ls['stime'] ? '提现处理时间：' . date('Y-m-d H:i', $ls['stime']) : '提现等待处理') : ''); ?></td>
							<td><?php echo $ls['note']; ?></td>
							<td><?php echo date('Y-m-d H:i:s', $ls['mktime']); ?></td>
							<td><?php echo $state[$ls['state']]; ?></td>
						</tr>
						<?php }  } ?>
						
						
					</tbody>
</table>
</div>
</div>
<div class="panel panel-default">
				<div class="panel-heading">
					物流
				</div>
				<div class="panel-body">
				
<table class="table table-hover table-responsive">
					<thead>
						<tr>
							<th>物流内容</th>
							<th>时间</th>
						</tr>
					</thead>
					<tbody>
						<?php if($wl['data']){ foreach($wl['data'] as $v){?>
						<tr>
							<td><?php echo $v['context']; ?></td>
							<td><?php echo $v['time']; ?></td>
						</tr>
						<?php } }else{?>
						<tr>
							<td>此单号无记录，请核对快递公司名称和运单号码是否正确！</td>
						</tr>
						<?php } ?>
					</tbody>
</table>
</div>
</div>


<div class="modal fade" id="wl_up">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
					&times;
				</button>
				<h4 class="modal-title">修改物流信息</h4>
			</div>
			<div class="modal-body">
				<div class="form-group fl_name">
						<label>物流</label>
						<select id="wl_name" class="form-control" name="wl_name">
							<?php
							$wl=$this->config->item('wl');
							foreach($wl as $k=>$v){
							?>
							<option  <?php if($bill['wl_name']==$k){ echo 'selected'; }?> value="<?php echo $k; ?>"><?php echo $k; ?></option>
							<?php } ?>
						</select>
					</div>
					<div class="form-group fl_name">
						<label>物流编号</label>
						<input name="idx" type="hidden" id="idx" value="<?php echo $bill['bill_id']; ?>" />
						<input id="wl_hao" name="wl_hao" type="text" class="form-control" value="<?php echo $bill['wl_hao']; ?>" />
					</div>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn" data-dismiss="modal">
					<i class="fa  fa-compress"></i> 
					关闭
				</button>
				<button type="button" class="btn blue" onclick="doup_wl()">
					<i class="fa fa-send"></i> 
					设置
				</button>
			</div>
		</div>
	</div>
</div>
					
					
					
				</div>
			</div>
		</div>
	</div>
	

	<!-- BEGIN QUICK SIDEBAR -->
	<?php $this -> load -> view('adminx/lt'); ?>
	<!-- END QUICK SIDEBAR -->
</div>
<!-- END CONTAINER -->
<!-- BEGIN FOOTER -->
<?php $this -> load -> view('adminx/footer'); ?>
<script src="/mex/lance/bill.js"></script>